<%--
  Created by IntelliJ IDEA.
  User: voove
  Date: 2019/2/16
  Time: 16:38
  To change this template use File | Settings | File Templates.
--%>
<%@ page language="java" contentType="text/html; charset=utf-8"
         pageEncoding="utf-8"%>
<!DOCTYPE html>
<html>
<head>
    <title>ITPMP</title>
    <%@ include file="common.jsp" %>
</head>
<body>
<%@ include file="top.jsp" %>
<%@ include file="navi.jsp" %>
<div id="main-content">

    <div class="list_main">
        <!--c-->
        <div class="top_box">
            <div class="fl">
                <h1>检索功能</h1>
                <p><a href="index.jsp">Home</a><em>/</em><a href="javascript:void(0)">Search</a><em>/</em>Details</p>
            </div>
        </div>

        <div class="padding20">
            <div id="toolbar" class="toolbar">
                <em>承运人名称</em>
                <div class="input10"><input class="easyui-textbox" type="text" name="carrier" style="height:30px; width:100%"></div>
                <em>到期时间</em>
                <div class="input10"><input id="startTime" class="easyui-datebox" type="text" name="startTime" style="height:30px; width:100%"></div>
                <em>~</em>
                <div class="input10"><input id="endTime" class="easyui-datebox" type="text" name="endTime" style="height:30px; width:100%"></div>
                <a href="javascript:void(0);"  class="btn btn-primary" onclick="doSearch()"><i class="fa fa-search"></i>查询</a>
            </div>
            <table class="easyui-datagrid" id="tt" style="width: auto"></table>
        </div>
        <!--c END-->
    </div>
</div>
<!--修改密码-->
<%@ include file="changePassword.jsp" %>
<!--修改密码 END-->
<!--查看许可-->
<div id="blkwindow" class="easyui-window" title="黑名单详情" data-options="closed:true,collapsible:false,minimizable:false,modal:true,maximizable:false,cache: false,footer:'#ftrr'" style="padding:10px; width:70%; height:56%; text-align:center">
</div>
<div id="ftrr" style="text-align: center; padding: 10px 0">
</div>
<div id="codess" style="display:none"></div>
<!--查看黑名单 END-->
<!--黑名单解封原因-->
<div class="add_none">
    <div id="blkrejected" class="easyui-window" title="填写理由" data-options="closed:true,collapsible:false,minimizable:false,modal:true,maximizable:false,top:($(window).height()*0.3)" style="padding:15px; width:669px; height:auto">
        <form id="blkrejectedDel" method="post" enctype="multipart/form-data">
            <table width="100%" border="0" cellspacing="0" cellpadding="0" class="table">
                <tr>
                    <td style="text-align: center"><font color="red">*</font>解封黑名单原因</td>
                    <td class="t80">
                        <input id="cancelBlkListOpinion" name="cancelBlkListOpinion" class="easyui-textbox"
                               style="width:500px;height: 120px;"
                               data-options="multiline:true,required:true"/>
                    </td>
                </tr>
            </table>
            <div class="window_foot" style="text-align: center; padding: 5px 0">
                <input id="blkCancelButton" type="submit" class="btn btn-default" value="提交" onclick="blkCancel()"/>
            </div>
        </form>
    </div>
</div>
<!--黑名单解封原因END-->
<script type="text/javascript" src="js/kol.js"></script>
<script>
    $('#main-content').height($('body').height()-0);
    $('.list_main').height($('#main-content').height()-61);
    $('.padding20').height($('.list_main').height()-111);
    $(window).resize(function(){
        $('#main-content').height($('body').height()-0);
        $('.list_main').height($('#main-content').height()-61);
        $('.padding20').height($('.list_main').height()-111);
        $('#tt').datagrid('resize');
    });
</script>
<script>
    $(function(){
        //黑名单信息查询
        $('#tt').datagrid({
            height:'100%',
            remoteSort:false,
            singleSelect:true,
            nowrap:false,
            fitColumns:true,
            toolbar:'#toolbar',
            striped:true,
            rownumbers:true,
            pagination:true,
            pageSize:10,
            pageNumber:1,
            pageList:[10,20,30,40,50],
            url:"blacklist/findBlacklistInfoByPage.do",
            columns:[[
                {field:'type',title:'承运人类型',width:30,sortable:true,align:'center'},
                {field:'applyObj',title:'承运人名称',width:75,sortable:true,align:'center'},
                {field:'applyname',title:'联系人',width:30,sortable:true,align:'center'},
                {field:'telephone',title:'联系电话',width:35,sortable:true,align:'center'},
                {field:'applyAddress',title:'联系地址',width:80,sortable:true,align:'center'},
                {field:'defriendtime',title:'加入黑名单时间',width:36,sortable:true,align:'center'},
                {field:'expiretime',title:'有效期限',width:50,sortable:true,align:'center'},
                {field:'operation',title:'操作',width:40,formatter:operation,align:'center'}
            ]],
            onLoadSuccess:function(data){
                if(data.total==0){
                    var body = $(this).data().datagrid.dc.body2;
                    body.find('table tbody').append('<tr><td width="'+body.width()+'" style="height: 25px; text-align: center;" colspan="10">没有数据</td></tr>');
                }
            }
        });
        $('#tt').datagrid('resize');

    });
    function operation(value, row, index) {
        var a = "<shiro:hasPermission name='permission:retrieve'><a href='javascript:void(0);' onclick='lookInfo(\""+ index +"\")' class='btn btn-primary btn-xs'>查看</a></shiro:hasPermission>";
        var b = "&nbsp;<shiro:hasPermission name='limit:blacklistAudit'><a href='javascript:void(0);' onclick='deleteBlacklist(\""+ row.projid +"\")' class='btn btn-danger btn-xs'>解封</a></shiro:hasPermission>";
        <%--if(row.state!="无效")--%>
        <%--{--%>
        <%--b =b+ "&nbsp;<shiro:hasPermission name='permission:retrieve'><a href='javascript:void(0);' onclick='deletePass(\""+ index +"\")' class='btn btn-primary btn-xs'>作废</a></shiro:hasPermission>";--%>
        <%--}--%>
        return a+b;
    }
    //黑名单解封
    function deleteBlacklist(value){
        $.messager.confirm("操作提示", "您确定要将该条记录从黑名单中解封吗？", function (data) {
            if (data) {
                // alert("是");
                // $.ajax({
                //     async : false,
                //     cache : false,
                //     data : {
                //         projid : value
                //     },
                //     type : "POST",
                //     url : 'blacklist/deleteBlacklistObj.do',
                //     success : function(result) {
                //         $("#tt").datagrid("reload");
                //     }
                // });
                $("#blkrejected").window('open');

            }
            else {
                // alert("否");
            }
        });
    }

    function blkCancel()
    {
        var row = $("#tt").datagrid("getSelected");
        var opinion = $("#cancelBlkListOpinion").textbox('getText');
        if(opinion=="")
        {
            $.messager.alert("提示","请填写原因");
            return false;
        }
        $("#blkrejectedDel").form({
            dataType : 'text',
            url:"blacklist/deleteBlacklistObj.do?projid="+row.projid+"&opinion="+opinion,
            success: function(result){
                if(result=="success"){
                    $("#tt").datagrid('reload');
                    $("#blkrejected").window('close');
                    $.messager.alert('提示',"操作成功");
                }
            }
        });
    }

    function lookInfo(index){
        var row=$('#tt').datagrid('getRows')[index];
        var value=row.projid;
        $("#blkwindow").empty();
        $("#ftrr").empty();
        $.ajax({
            url:"blacklist/getPassInfoByProjid.do",
            type:"post",
            data:{
                projid:value
            },
            dataType:"json",
            success:function(result){
                if(result.status){
                    console.log(row);
                    var passinfo = result.data;
                    var ext = passinfo.extName;
                    var url = passinfo.attachurl;
                    var picURL = "blacklist/downLoadBlklDoc.do?fileName="+url+"&fileUrl="+url;
                    var pdfURL = "blacklist/getPdfURL.do?fileName="+url+"&fileUrl="+url;
                    var table = "";
                    table += '<div class="w60">';
                    //许可证信息
                    // table += '<table width="100%" border="0" cellspacing="0" cellpadding="0" class="table" >';
                    // table += '<tr><th class="caption" colspan="4">行驶信息</th></tr>';
                    // table += '<td class="t20 tright">车牌号码：</td>';
                    // table += '<td class="t30 tleft">' + passinfo.carnum + '</td>';
                    // table += '<td class="t20 tright"></td>';
                    // table += '<td class="t30 tleft"></td></tr>';
                    // table += '<tr><td class="t20 tright">承运单位：</td>';
                    // if(passinfo.company==null||passinfo.company=="")table += '<td class="t30"></td>';
                    // else table += '<td class="t30 tleft">' + passinfo.company + '</td>';
                    // table += '<td class="t20 tright">通行日期：</td><td class="t30 tleft">' + passinfo.startTime + '至' + passinfo.endTime + '</td></tr>';
                    // table += '<tr><td class="t20 tright">车辆类型：</td>';
                    // table += '<td class="t30 tleft">' + passinfo.cartype + '</td>';
                    // table += '<td class="t20 tright">货物名称：</td><td class="t30 tleft">'+passinfo.goodsName+'</td></tr>';
                    // table += '<tr><td class="t20 tright">自重（吨）：</td><td class="t30 tleft">'+passinfo.truckWeight+'</td>';
                    // table += '<td class="t20 tright">货物载重（吨）：</td><td class="t30 tleft">'+passinfo.goodsWeight+'</td></tr>';
                    // table += '<tr><td class="t20 tright">载后尺寸：</td><td class="t30 tleft">';
                    // table += '长 ' + passinfo.loadingsizeLongth + 'm 宽 ' + passinfo.loadingsizeWidth + 'm  高 ' + passinfo.loadingsizeHeight + 'm</td>'
                    // table += '<td class="t20 tright">轴荷分布：</td>';
                    // table += '<td class="t30 tleft">' + passinfo.axleNum + '</td></tr>';
                    // table += '<tr><td class="t20 tright">通行路线：</td>';
                    // table += '<td class="t30 tleft" colspan="3">' + passinfo.roads + '</td></tr></table>';
                    //承运人信息
                    table += '<div class="blank10"></div>' ;
                    table += '<table width="100%" border="0" cellspacing="0" cellpadding="0" class="table" >';
                    table += '<tr><th class="caption" colspan="4">承运人信息</th></tr>';
                    table += '<tr><td class="t20 tright">承运人：</td>';
                    if(passinfo.company==null||passinfo.company=="")table += '<td class="t30 tleft"></td>';
                    else table += '<td class="t30 tleft">' + passinfo.company + '</td>';
                    if(passinfo.enterpriseOrIndividual=="个人"){
                        table += '<td class="t20 tright" >身份证：</td><td class="t30 tleft">'+passinfo.applyCardnumber+'</td></tr>';
                    }
                    else if(passinfo.enterpriseOrIndividual=="企业"){
                        table += '<td class="t20 tright">统一社会信用代码：</td><td class="t30 tleft">'+passinfo.uniscid+'</td></tr>';
                        table += '<td class="t20 tright">法人代表：</td>';
                        table += '<td class="t30 tleft">' + passinfo.legalPerson + '</td>';
                        table += '<td class="t20 tright">法人代表证件号：</td>';
                        table += '<td class="t30 tleft">' + passinfo.legalPersonPaperNo + '</td></tr>';
                    }
                    else {
                        table += '<td class="t20 tright">证件：</td><td class="t30"></td></tr>';
                        table += '<td class="t20 tright">法人代表：</td>';
                        table += '<td class="t30 tleft"></td>';
                        table += '<td class="t20 tright">法人电话：</td>';
                        table += '<td class="t30 tleft"></td></tr>';
                    }
                    table += '<tr><td class="t20 tright">联系地址：</td>';
                    table += '<td class="t30 tleft" colspan="3">' + passinfo.applyAddress + '</td></tr>';
                    table += '<td class="t20 tright">联系人：</td>';
                    table += '<td class="t30 tleft">' + passinfo.userName + '</td>';
                    table += '<td class="t20 tright">联系电话：</td>';
                    table += '<td class="t30 tleft">' + passinfo.userPhone + '</td></tr></table>';
                    //黑名单申请信息
                    table += '<div class="blank10"></div>' ;
                    table += '<table width="100%" border="0" cellspacing="0" cellpadding="0" class="table" >';
                    table += '<tr><th class="caption" colspan="4">黑名单提交信息</th><tr>';
                    table += '<tr><td class="t20 tright">经办人：</td>';
                    table += '<td class="t30 tleft">' + passinfo.byPeopleUser + '</td>';
                    table += '<td class="t20 tright">经办单位：</td>';
                    table += '<td class="t30 tleft">' + passinfo.orgname + '</td></tr>';
                    table += '<td class="t20 tright">处理时间：</td>';
                    table += '<td class="t30 tleft">' + passinfo.submitTime + '</td>';
                    table += '<td class="t20 tright">经办人联系方式：</td>';
                    table += '<td class="t30 tleft">' + passinfo.byPeopletel + '</td></tr>';
                    table += '<tr><td class="t20 tright">建议处罚意见：</td>';
                    table += '<td class="t30 tleft" style="" colspan="3">' + passinfo.opinion + '</td></tr>';
                    table += '<tr><td class="t20 tright">处罚决定书：</td>';
                    table += '<td class="t30 tleft" colspan="3">' +
                        '<a class="cursor" onclick="showAttach(\''+ext+'\',\''+picURL+'\',\''+pdfURL+'\')">'
                        + passinfo.attachname + '</a>&nbsp;&nbsp;' +
                        '<a class="cursor" style="color:#33577b" onclick="downLoadBlklDoc(\''+row.docName+'\',\''+row.docURL+'\')">下载</a>'+ '</td></tr></table>';
                    table += '<div class="blank10"></div>' ;
                    table += '<table width="100%" border="0" cellspacing="0" cellpadding="0" class="table" >';
                    table += '<tr><th class="caption" colspan="4">黑名单审核信息</th><tr>';
                    table += '<tr><td class="t20 tright">审核人：</td>';
                    table += '<td class="t30 tleft">' + passinfo.auditPeople + '</td>';
                    table += '<td class="t20 tright">审核单位：</td>';
                    table += '<td class="t30 tleft">' + passinfo.auditOrg + '</td></tr>';
                    table += '<tr><td class="t20 tright">加入黑名单时间：</td>';
                    table += '<td class="t30 tleft">' + passinfo.defriendtime + '</td>';
                    table += '<td class="t20 tright">有效期限：</td>';
                    table += '<td class="t30 tleft">' + passinfo.expiretime + '</td></tr>';
                    table += '</table>';
                    table += '</div>';
                    table += '<div class="w40">' +
                        '<div  style="height:100%;position:relative;">' +
                        '<div id="message1" class="message" ></div>' +
                        '<div id="message2" class="message" style="display:none" type="application/pdf">>pdf部分</div>' +
                        '</div>' +
                        '</div>';
                    var footer = '<a href="javascript:void(0)" onclick="closeWindow()" class="btn btn-default">关闭</a>';
                    // table += '</div>';
                    $("#blkwindow").append(table);
                    $("#ftrr").append(footer);
                    console.log(pdfURL);
                    showAttach(ext,picURL,pdfURL);
                }else{
                    var msg = result.message;
                    var div = "<div>" + msg + "</div>";
                    $("#blkwindow").append(div);
                }
            }
        });
        $("#blkwindow").window('open');
    }


    //字符串时间比较
    function compareDate(DateOne, DateTwo) {
        var oDate1 = new Date(DateOne);
        var oDate2 = new Date(DateTwo);
        if(oDate1.getTime() > oDate2.getTime()){
            return true;
        } else {
            return false;
        }
    }
    //条件黑名单信息查询
    function doSearch(){
        var carrier = $("input[name='carrier']").val();
        var startTime = $("input[name='startTime']").val();
        var endTime = $("input[name='endTime']").val();
        $("#tt").datagrid("load",{applyobj:carrier,startTime:startTime,endTime:endTime});
    }
    function closeWindow() {
        $("#blkwindow").window('close');
    }





</script>
</body>
</html>

